<template>
  <a-table :data="list" :pagination="false" class="table-singe-line show-border-table" size="mini" :scroll="{ y: '100%' }">
    <template #columns>
      <a-table-column title="资料类型" data-index="type" />
      <a-table-column title="附件">
        <template #cell="{ record }">
          <img width="40" height="40" v-if="record.fileType != 'img'" :src="typMap[record.fileType || 'sub']" alt="" />
          <img style="width: 40px; height: 40px" v-else :src="record.url" alt="" />
        </template>
      </a-table-column>
      <a-table-column title="资料名称">
        <template #cell="{ record }">
          <TextLimit :rows="1" position="top" :val="record.name" />
        </template>
      </a-table-column>
      <a-table-column title="操作人" data-index="createUname" />
      <a-table-column title="操作时间">
        <template #cell="{ record }">
          {{ $setTime(record.gmtCreate) }}
        </template>
      </a-table-column>
    </template>
  </a-table>
</template>

<script lang="ts" setup>
  import { computed } from 'vue'
  import world from '@/assets/word.png'
  import excel from '@/assets/excel-.png'
  import pdf from '@/assets/pdf1.png'
  import cad from '@/assets/CAD.png'
  import psd from '@/assets/psd.png'
  import sub from '@/assets/yuanwenjian-1.png'
  const props = defineProps({
    productInfo: {
      type: Object,
      default: () => {},
    },
  })
  const typMap = {
    world: world,
    excel: excel,
    pdf: pdf,
    cad: cad,
    psd: psd,
    sub: sub,
  }
  const list = computed(() => props.productInfo?.productInfoList || [])
</script>

<style lang="less" scoped></style>
